// import _ from 'lodash';
import * as types from '@/store/mutation-types';
import sendgetRestaurant from '@/request/restanrant';
// import { get } from '@/common/utils';

export default {
  // 发送请求
  async getRestaurant({ commit }) {
    try {
      //* 显示loding
      commit(types.SHOW_LOADING);

      const result = await sendgetRestaurant(); // 从后台拿到全部的商店
      console.log('result==>', result);

      commit(types.SAVE_SHOP_LIST, { list: result.list }); // 放到vuex里面
    } catch (error) {
      commit(types.SHOW_ALERT, { message: error.message });
    } finally {
      // * 最终移除loading
      commit(types.HIDE_LOADING);
    }
  },

};
